INCL = -Iinc
DEPS = $(wildcard inc/*.h)
SRCS = $(wildcard src/*.c)
OBJS = $(patsubst src/%.c,obj/%.o, $(SRCS))
TARGET = server
CC = gcc
CFLAGS = -Wall -Wextra -g 
DEPFLAGS := -pthread

vpath %.h inc

all: clean $(TARGET)

$(TARGET): $(OBJS)
	$(CC) $(CFLAGS) $(DEPFLAGS) $(OBJS) -o $(TARGET) $$(mysql_config --libs)

obj/%.o: src/%.c $(DEPS)
	$(CC) $(CFLAGS) $(DEPFLAGS) -c $(INCL) $< -o $@

.PHONY: clean
clean:
	rm -rf $(OBJS) $(TARGET)